﻿using System;
using System.Collections.Generic;
using System.Text;

namespace IllustratedCsharp7_ch8_chapt8_4
{/// <summary>
/// 屏蔽基类的成员
/// </summary>
    class chaptt8_4
    {
        static void _Main()
        {
            OtherClass oc = new OtherClass();       //使用屏蔽成员
            oc.Method1(oc.Filed1);
        }
    }

    class SomeClass                      //基类
    {
        public string Filed1 = "base class field";
        public void Method1(string value)
        {
            Console.WriteLine($"Base class --Method1: {value}");
        }
    }
    class OtherClass : SomeClass                  //派生类
    {
        new public  string Filed1 = "OtherClass  Field1";//屏蔽基类成员
        new public void Method1(string value)             //屏蔽基类成员
        {
            Console.WriteLine($"OtherClass.Method1: {value}");
        }
    }
}
